
<%@ page import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    //Date date=new Date();
    request.setAttribute("now",new Date());
    request.setAttribute("age",72);
    request.setAttribute("fruit",new String[]{"apple","banana","taozi","水蜜桃","凤梨"});
    request.setAttribute("str","<script>alert('Are you ok?');</script>");
%>
<c:out value="${str}"/>
<hr/>
${str}
<c:remove var="str"/>
<ul>
    <c:forEach var="f" items="${fruit}" varStatus="s">
        <li>${s.count}:${f}</li>
    </c:forEach>
    <c:if test="${age>=18}">
        成年人
    </c:if>
    <c:if test="${age>=60}">
        离退休人员
    </c:if>
    <c:if test="${age<18}">
        未成年人
    </c:if>
    <hr/>
    <c:choose>
        <c:when test="${age>=60}">
            离退休人员
        </c:when>
        <c:when test="${age>=18}">
            成年人
        </c:when>
        <c:otherwise>
            未成年人
        </c:otherwise>
    </c:choose>
</ul>
<h2>
    ${now},

        <fmt:formatDate value="${now}" pattern="MM月dd日 hh:时mm分"/>
</h2>
<div>
    <!-- 1到40-->
    <c:forEach begin="1" end="40" var="i" step="4">
        ${i} &nbsp;
    </c:forEach>
</div>
<div>
    <%
        Map<String,String> map=new HashMap<>();
        map.put("dog","狗");
        map.put("cat","猫");
        map.put("sheep","绵阳");
        map.put("snake","蛇");
        request.setAttribute("map",map);
    %>
    <c:forEach items="${map}" var="m">
        ${m.key}==${m.value}<br/>
    </c:forEach>
</div>
</body>
</html>
